package com.yjq.programmer.controller.admin;

import com.yjq.programmer.dto.AlbumDTO;
import com.yjq.programmer.dto.PageDTO;
import com.yjq.programmer.dto.ResponseDTO;
import com.yjq.programmer.service.IAlbumService;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

/**
 * @author 杨杨吖
 * @QQ 823208782
 * @WX yjqi12345678
 * @create 2022-11-14 8:57
 */
@RestController("AdminAlbumController")
@RequestMapping("/admin/album")
public class AlbumController {

    @Resource
    private IAlbumService albumService;

    /**
     * 分页获取专辑数据
     * @param pageDTO
     * @return
     */
    @PostMapping("/list")
    public ResponseDTO<PageDTO<AlbumDTO>> getAlbumListByPage(@RequestBody PageDTO<AlbumDTO> pageDTO){
        return albumService.getAlbumListByPage(pageDTO);
    }

    /**
     * 保存专辑数据(添加、修改)
     * @param albumDTO
     * @return
     */
    @PostMapping("/save")
    public ResponseDTO<Boolean> saveAlbum(@RequestBody AlbumDTO albumDTO){
        return albumService.saveAlbum(albumDTO);
    }

    /**
     * 删除专辑数据
     * @param albumDTO
     * @return
     */
    @PostMapping("/remove")
    public ResponseDTO<Boolean> removeAlbum(@RequestBody AlbumDTO albumDTO){
        return albumService.removeAlbum(albumDTO);
    }

    /**
     * 获取全部专辑数据
     * @return
     */
    @PostMapping("/all")
    public ResponseDTO<List<AlbumDTO>> getAllSinger() {
        return albumService.getAllAlbum();
    }


    /**
     * 获取专辑总数
     * @return
     */
    @PostMapping("/total")
    public ResponseDTO<Integer> getAlbumTotal(){
        return albumService.getAlbumTotal();
    }
}
